﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Buca.Application.aBigTime.Model.BusinessObjects.Cash;
using Buca.Application.aBigTime.Presenter.Cash.ReceiptVoucher;
using Buca.Application.aBigTime.View.Cash;
using Buca.Application.aBigTime.WindowsForm.FormBase;
using Buca.Application.aBigTime.WindowsForm.FormBase.PropertyGrid;

namespace Buca.Application.aBigTime.WindowsForm.FormBusiness
{
    public partial class FrmReceiptVoucherList : FrmBaseVoucherList, IReceiptVouchersView
    {
        private ReceiptVouchersPresenter _receiptVouchersPresenter;

        public IList<ReceiptVoucherModel> ReceiptVouchers
        {
            set
            {
                //.DataSource = value;

                ColumnsCollection.Add(new XtraColumn { ColumnName = "ReceiptVoucherID", ColumnVisible = false });
                ColumnsCollection.Add(new XtraColumn { ColumnName = "Description", ColumnVisible = false });
                ColumnsCollection.Add(new XtraColumn { ColumnName = "ReceiptVoucherDetails", ColumnVisible = false });
                ColumnsCollection.Add(new XtraColumn { ColumnName = "Code", ColumnCaption = "Mã CT", ColumnPosition = 1, ColumnVisible = true, ColumnWith = 100 });
                ColumnsCollection.Add(new XtraColumn { ColumnName = "RefDate", ColumnCaption = "Ngày CT", ColumnPosition = 2, ColumnVisible = true, ColumnWith = 300 });
                ColumnsCollection.Add(new XtraColumn { ColumnName = "TotalAmount", ColumnCaption = "Số tiền", ColumnPosition = 3, ColumnVisible = true, ColumnWith = 200 });
                ColumnsCollection.Add(new XtraColumn { ColumnName = "CreateBy", ColumnCaption = "Người tạo", ColumnPosition = 4, ColumnVisible = true, ColumnWith = 100 });
            }
        }

        public FrmReceiptVoucherList()
        {
            InitializeComponent();
            _receiptVouchersPresenter = new ReceiptVouchersPresenter(this);
        }

        protected override void LoadDataIntoGrid()
        {
            _receiptVouchersPresenter.Display();
        }

        protected override void DeleteGrid()
        {
            new ReceiptVoucherPresenter(null).Delete(int.Parse(PrimaryKeyValue));
        }
    }
}
